<?php

use yii\db\Schema;
use yii\db\Migration;

class m150617_093522_update_creative_for_corner_mark extends Migration
{
    public function up()
    {
        $this->addColumn('{{%creative}}', 'type', 'int(1) not null default 0 comment "视频创意有效，1 表示为角标" after form');
        $this->alterColumn('{{%creative}}', 'material_id', 'varchar(64) default null comment "素材id列表，逗号分隔"');
        $this->alterColumn('{{%creative}}', 'width', 'varchar(64) default null comment "素材宽列表，逗号分隔"');
        $this->alterColumn('{{%creative}}', 'height', 'varchar(64) default null comment "素材高列表，逗号分隔"');
        $this->alterColumn('{{%creative}}', 'file_url', 'text default null comment "素材地址列表，逗号分隔"');
        $this->alterColumn('{{%creative}}', 'size', 'varchar(64) default null comment "素材大小列表，逗号分隔"');
		$this->alterColumn('{{%creative}}', 'ext', "varchar(64) DEFAULT NULL COMMENT '素材后缀' after file_url");
		$this->alterColumn('{{%creative}}', 'format_id', "varchar(32) NOT NULL COMMENT '1 static-pic, 2 dynamic-pic, 3 swf, 4 txt, 5 flv, 6 mp4'");
    }

    public function down()
    {
        $this->dropColumn('{{%creative}}', 'type');
        $this->alterColumn('{{%creative}}', 'material_id', "int(11) unsigned NOT NULL COMMENT '素材id'");
        $this->alterColumn('{{%creative}}', 'width', "int(10) unsigned NOT NULL");
        $this->alterColumn('{{%creative}}', 'height', "int(10) unsigned NOT NULL");
        $this->alterColumn('{{%creative}}', 'file_url', "varchar(2000) DEFAULT NULL COMMENT '视频素材的url地址'");
        $this->alterColumn('{{%creative}}', 'size', "int(10) NOT NULL COMMENT '素材容量'");
		$this->alterColumn('{{%creative}}', 'ext', "varchar(20) DEFAULT NULL COMMENT '素材后缀' after file_url");
		$this->alterColumn('{{%creative}}', 'format_id', "int(3) unsigned NOT NULL COMMENT '1 static-pic, 2 dynamic-pic, 3 swf, 4 txt, 5 flv, 6 mp4'");
    }
}
